﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="admin_title_add.aspx.cs" Inherits="skvote.admin_title_add" %>

<%@ Import Namespace="System.Data.OleDb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<%skvote.function.header(Response);%>
<title>【单考投票系统】后台管理中心</title>
</head>
<script language="javascript">
function check(){
	if(form1.sid.selectedIndex==-1){
		lblsubject.innerHTML = "所属主题不能为空！";
		form1.sid.focus();
		return false;}
	else{
		lblsubject.innerHTML = "";}	
	if(form1.title.value==""){
		lbltitle.innerHTML = "投票问题不能为空！";
		form1.title.focus();
		return false;}	
	else{
		lbltitle.innerHTML = "";}	
	return true;
	}
</script>
<body>
<table border="0" cellpadding="1" cellspacing="2" width="100%" id="table1" bgcolor="#E1F0FF">
  <tr>
      <table width="100%" id="table2" cellspacing="1">
	     <tr>
          <td id="TableTitle1"> 添加投票问题-&gt;</td>
		 </tr>
	   </table>
  </tr>
  <tr>
    <td>
	   <table border="1" cellpadding="4" cellspacing="0" width="100%" id="table2" bordercolor="#BFDFFF">
        <form action="" method="post" name="form1" onsubmit="return check()" runat="server">
          <tr>
            <td width="20%" align="right">所属主题名称：</td>
            <td><select name="sid" id="sid">
              <%
                  OleDbConnection connection = new skvote.conn().CreateConnection();
                  try
                  {
                      OleDbCommand cmd = new OleDbCommand("select [id],subject from xh_subject", connection);
                      OleDbDataReader dr = cmd.ExecuteReader();
                      while (dr.Read())
                      {
                          Response.Write("<option value='" + dr["id"].ToString() + "'>" + dr["subject"].ToString() + "</option>");
                      }
                      dr.Close();
                      cmd.Dispose();
                  }
                  finally
                  {
                      connection.Close();
                  }                  
              %>              
              </select><label id="lblsubject"></label></td>
          </tr>
          <tr>
            <td width="20%" align="right">投票问题名称：</td>
            <td><input type="text" name="title" size="25"><label id="lbltitle"></label></td>
          </tr>
          <tr>
            <td width="20%" align="right">投票类型：</td>
            <td><select size="1" name="ms" id="ms">
                <option value="1">单选</option>
                <option value="2">多选</option>
              </select></td>
          </tr>
          <tr>
            <td width="20%" align="right">列表类型：</td>
            <td><select size="1" name="listType">
                <option value="0">文本</option>
                <option value="1">图片</option>
              </select></td>
          </tr>
          <tr>
            <td width="20%" align="right">每行排列数：</td>
            <td><select size="1" name="listRows" id="listRows">
            <%
                for (int i = 1; i <= 20; i++)
                {
                    Response.Write("<option value='" + i.ToString() + "'>" + i.ToString() + "</option>");
                }
            %>				
              </select></td>
          </tr>		  
          <tr>
            <td colspan="2" align="center" bgcolor="#BFDFFF"><!--<input class="btn" type="submit" name="submit" value=" 添 加 ">-->
                <asp:Button ID="submit" Text="添加" runat="server" class="btn" 
                    onclick="submit_Click" /></td>
          </tr>
        </form>
      </table></td>
  </tr>
</table>
</body>
</html>